package com.ruoyi.web.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.validator.group.AddGroup;
import com.ruoyi.common.validator.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.List;

@Data
@TableName("org_organization")
public class OrgOrganization extends BaseEntity{

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @Null(groups = {AddGroup.class})
    @NotNull(groups = {UpdateGroup.class})
    private Long id;

    /** 机构名 */
    @Excel(name = "机构名")
    @NotBlank(groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    /** 简称 */
    //@Excel(name = "简称")
    //@NotBlank(groups = {AddGroup.class, UpdateGroup.class})
    private String alias;

    /** 机构编号*/
    @Excel(name = "机构编号")
    @NotBlank(groups = {UpdateGroup.class})
    private String organizationCode;

    private Integer organizationType;

    /** 地区id */
    private Long areaId;

    /** 地区编号 */
    @Excel(name = "区划编号")
    private String areaCode;

    /** 地区全名 */
    @Excel(name = "区划全名")
    private String areaFullName;

    /** 地址 */
    @Excel(name = "地址")
    private String address;

    /** 机构状态 */
    @Excel(name = "机构状态")
    @NotNull(groups = {AddGroup.class, UpdateGroup.class})
    private Integer organizationStatus;

    /** 黑名单 */
    @Excel(name = "黑名单", readConverterExp = "1=黑名单,2=白名单")
    @NotNull(groups = {AddGroup.class, UpdateGroup.class})
    private Integer blacklist;

    @TableLogic
    private Integer delStatus;

    @TableField(exist = false)
    @NotEmpty(groups = {AddGroup.class, UpdateGroup.class})
    private List<Long> areaIds;

    @TableField(exist = false)
    private List<OrgOrganization> children;
}
